#include<stdio.h>
#include<stdlib.h>

void test1()
{
	int num;
	unsigned int i = 0;
	int R;
	int bitnum[100];

	scanf("%d,%d", &num, &R);
	while(num!=0)
	{
		bitnum[i] = num % R;
		i++;
		num = num/R;
	}
	while(i--)
		printf("%d",bitnum[i]);

	printf("\n");
}

void main()
{
	test1();
}
